package com.zc.employee.utils;

import javax.servlet.ServletContext;

import org.apache.struts2.ServletActionContext;

import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.interceptor.MethodFilterInterceptor;
import com.zc.employee.domain.Employee;

public class LoginInterceptor extends MethodFilterInterceptor {

	@Override
	protected String doIntercept(ActionInvocation actionInvocation) throws Exception {
		// TODO Auto-generated method stub
		Employee existEmployee = (Employee) ServletActionContext.getRequest().getSession().getAttribute("existEmployee");
		if(existEmployee == null){
			
			ActionSupport actionSupport = (ActionSupport) actionInvocation.getAction();
			return "input";
			
		}
		return actionInvocation.invoke();
	}

}
